// Upgrade NOTE: commented out 'float4x4 _Object2World', a built-in variable
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'


Shader  "Vert/GrowTreeLeavesDoubleClipCompound" {

	Properties
	 {
 _MainTex ("Texture", 2D) = "white" {}
 _Magnitude ("Distortion Magnitude", Float) = 1
 _Frequency ("Distortion Frequency", Float) = 1
 _Wavelength ("Distortion Wavelength", Float) = 1
 _Plane ("_Plane", Vector) = (0,1,0,1)
 _Plane2 ("_Plane2", Vector) = (0,1,0,1)
}

	

	SubShader
     {
  Tags { "QUEUE"="Transparent" "RenderType"="Transparent" }
  ZTest Less
  Cull Off
  Blend SrcAlpha OneMinusSrcAlpha

    LOD 100
	Pass
	{
	
	

	CGPROGRAM
	#pragma vertex vert
	#pragma fragment frag
	#include "UnityCG.cginc"
    //#define Fixed3(value)  fixed3(value, value,value)

	struct VertexInput {
    fixed4 vertex : POSITION;
	fixed2 xlv_TEXCOORD0 : TEXCOORD0;
    //fixed2 xlv_TEXCOORD1 : TEXCOORD1;
    //fixed3 xlv_TEXCOORD2 : TEXCOORD2;
    //fixed3 xlv_TEXCOORD3 : TEXCOORD3;
    //fixed4 tangent : TANGENT;
    fixed3 normal : NORMAL;
    fixed4 xlv_COLOR : COLOR;
	//VertexInput
	};


	struct VertexOutput {
	fixed4 pos : SV_POSITION;
    UNITY_FOG_COORDS(1)
    fixed4 xlv_COLOR : COLOR;
	fixed2 xlv_TEXCOORD0 : TEXCOORD0;
    fixed2 xlv_TEXCOORD1 : TEXCOORD1;
    //fixed3 xlv_TEXCOORD2 : TEXCOORD2;
    //fixed3 xlv_TEXCOORD3 : TEXCOORD3;
    //fixed3 xlv_TEXCOORD4 : TEXCOORD4;
	//VertexOutput
	};

	

 
 
 
 
 
 // float4x4 _Object2World;
 float4 _MainTex_ST;
 float _Magnitude;
 float _Frequency;
 float _Wavelength;
 
 
 


	

 sampler2D _MainTex;
 float4 _Plane;
 float4 _Plane2;
 
 




	VertexOutput vert (VertexInput v)
	{
	VertexOutput o;
	//o.pos = UnityObjectToClipPos (v.vertex);
	//o.xlv_TEXCOORD0 = TRANSFORM_TEX(v.xlv_TEXCOORD0, _MainTex);
	
  half2 tmpvar_1;
  float4 tmpvar_2;
  tmpvar_2.xzw = fixed3(0.0, 0.0, 0.0);
  tmpvar_2.y = ((sin(
    ((v.vertex.y / _Wavelength) + (_Frequency * _Time.x))
  ) + sin(
    ((v.xlv_TEXCOORD0.y / _Wavelength) + ((_Frequency * 1.3) * _Time.x))
  )) * (_Magnitude * (1.0 - v.xlv_COLOR.y)));
  float2 tmpvar_3;
  tmpvar_3 = ((v.xlv_TEXCOORD0 * _MainTex_ST.xy) + _MainTex_ST.zw);
  tmpvar_1 = tmpvar_3;
  o.pos = UnityObjectToClipPos( (v.vertex + tmpvar_2));
  o.xlv_COLOR = v.xlv_COLOR;
  o.xlv_TEXCOORD0 = tmpvar_1;
  o.xlv_TEXCOORD1 = mul(unity_ObjectToWorld , v.vertex).xyz;



    UNITY_TRANSFER_FOG(o,o.vertex);
   
	return o;
	}


	fixed4 frag(VertexOutput i) : SV_Target
    {
    //fixed4 tmpvar_2 = tex2D(_MainTex, i.uv);
	
  float4 tmpvar_1;
  float x_2;
  x_2 = (0.1 - ((
    fixed((0.0 >= (dot (i.xlv_TEXCOORD1, _Plane.xyz) - _Plane.w)))
   * 
    fixed((0.0 >= (dot (i.xlv_TEXCOORD1, _Plane2.xyz) - _Plane2.w)))
  ) * fixed(
    (-0.1 >= -(abs(dot (_Plane.xyz, fixed3(1.0, 1.0, 1.0)))))
  )));
  if ((x_2 < 0.0)) {
    discard;
  };
  fixed4 tmpvar_3;
  tmpvar_3 = tex2D (_MainTex, i.xlv_TEXCOORD0);
	UNITY_APPLY_FOG(i.fogCoord, tmpvar_3);
  tmpvar_1 = tmpvar_3;
   return tmpvar_1;
	}
	ENDCG
	}
  }
Fallback "Diffuse"
}

